package com.jzoom.zoom.pay;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jzoom.zoom.pay.models.Pay;
import com.jzoom.zoom.pay.models.Refund;


public interface PayAdapter {
	
	
	/**
	 * 设置支付成功监听
	 * @param listener
	 */
	void setPayAdapterListener(PayAdapterListener listener);
	
	/**
	 * 设置通知url的形式
	 * @param notifyUrl
	 */
	void setNotifyUrl(String notifyUrl);
	
	
	/**
	 * 预支付
	 * @param order							原记录
	 * @return
	 */
	void create(Pay order) throws PayException,IOException;
	
	/**
	 * 将原来的订单退掉
	 * @param order							原记录
	 * @throws PayException
	 * @throws IOException
	 */
	void refund(Refund refund) throws PayException,IOException;
	

	/**
	 * 支付平台后台通知
	 * @param request
	 * @param response
	 */
	void onServerNotify(HttpServletRequest request,HttpServletResponse response) ;
	
	/**
	 * 主动查询支付渠道状态
	 */
	void query(Pay pay) throws PayException,IOException;
}
